package com.qf.controller;

import com.qf.service.EsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author YuGan
 * 表中所有用户添加到ES中；
 * 1.创建索引
 * 2.批量导入数据
 */
@RestController
@RequestMapping("/es")
public class EsController {
    @Autowired
    private EsService esService;

    @GetMapping("/index/{user}")
    public String createIndex(@PathVariable String user){
        esService.createIndexUser(user);
        return "ok";
    }

    @GetMapping("/importIndex/{user}")
    public String ImportIndexUser(@PathVariable String user){

        esService.importIndexUser(user);
        return "ok";
    }

}
